home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cuj9204 / 1004091a < prev    next >
Text File  |  1992-06-02  |  506b  |  25 lines

  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. #define NUMELEMENTS(x) (sizeof(x)/sizeof(x[0]))
  6. #define INT 1
  7. #define LONG 2
  8. #define DOUBLE 3
  9.  
  10. typedef struct {
  11.     const char *stack_name;
  12.     void *pstack;
  13.     const int type;   /* type of entries */
  14.     size_t stack_ptr;
  15.     size_t max_stack;
  16. } stack;
  17.  
  18. int array1[10];
  19. static long array2[30];
  20.  
  21. stack stack1 = {"stack1", array1, INT,      0, NUMELEMENTS(array1)};
  22. stack stack2 = {"stack2", array2, LONG,   0, NUMELEMENTS(array2)};
  23. stack stack3 = {"stack3", NULL,   DOUBLE, 0, 0};
  24.  
  25.